#pragma once

#include <list>
#include <vector>

#include "CArea.h"
#include "AnimExecutor.h"
#include "CCamera.h"
#include "CFPS.h"
#include "CSurface.h"
#include "Acceleration.h"

enum EntityType
{
    ENTITY_TYPE_GENERIC,
    ENTITY_TYPE_PLAYER,
    ENTITY_TYPE_ENEMY
};
 
enum EntityFlag
{
    ENTITY_FLAG_NONE             = 0,
    ENTITY_FLAG_GRAVITY          = 0x00000001,
    ENTITY_FLAG_GHOST            = 0x00000002,
    ENTITY_FLAG_MAPONLY          = 0x00000004,
    ENTITY_FLAG_PHYSICAL_IMMUNE  = 0x00000008
};
 
class CEntity
{
    private:
        bool PosValid(int NewX, int NewY);
        bool PosValidTile(CTile* Tile);
        bool PosValidEntity(CEntity* Entity, int NewX, int NewY);

		float distanceToMoveX;
		float distanceToMoveY;
		static const float MAX_DISTANCE_PER_MOVE;
    
    protected:
        AnimExecutor animExecutor;
        SDL_Surface* Surf_Entity;
        float SpeedX;
        float SpeedY;
		bool CanJump; //NO MAKE SENSE
				
		virtual Acceleration UpdateAcceleration();

    
    public:
        CEntity();
        virtual ~CEntity();
        
        static std::list<CEntity*> EntityList;

        virtual bool OnLoad(char* File, int Width, int Height);
        virtual void OnLoop();
        virtual void OnRender(SDL_Surface* Surf_Display);
        virtual void OnCleanup();
        virtual void OnAnimate();
        virtual void OnCollision(CEntity* Entity);
        bool OnMove();
        bool Collides(int oX, int oY, int oW, int oH);
        bool Jump(); //ALSO NO MAKE SENSE
        
        float X;
        float Y;
        int Width;
        int Height;
        bool FacingRight;
        bool needsCleanup;
        EntityType Type;
        int Flags;
        float MaxSpeedX;
        float MaxSpeedY;
};
 
class CEntityCol
{
    public:
        CEntityCol();
        static std::vector<CEntityCol> EntityColList;
        CEntity* EntityA;
        CEntity* EntityB;
};
 